<div style="height:auto;width:100%">
<table class="tblInfo" id="frmhistoryinventory_tblinfo" width="100%">
<tr>
<td class="width25" height="400" valign="top"> 
<table class="info" id="frmhistoryinventory_info">
<tr>
<td>
<div  class="divleft">
<table class="width100">
<tr >
<td  class="lblRequired width30">Thời gian</td>
<td ><input id="frmhistoryinventory_date1" class="datereport txtRequired width35" onblur="formatddmmyyyy(this)" maxlength="10"  /><a href="javascript:frmhistoryinventory_cal1.popup();"><img src="adagps.com/images/cal/cal2.png" id="frmhistoryinventory_imgcal1"  class="datepicker dpkstart" ></a>
-<input id="frmhistoryinventory_date2"  class="datereport txtRequired width35" onblur="formatddmmyyyy(this)" maxlength="10" /><a href="javascript:frmhistoryinventory_cal2.popup();"><img src="adagps.com/images/cal/cal2.png" id="frmhistoryinventory_imgcal2"  class="datepicker dpkstart" ></a>
</td>
</tr>       
</table>
    <div class="divactionbuton">
        <button id="frmreportdetail_create" class="search" onclick="frmhistoryinventory_createReport();" type="button"> Xem </button>
    </div>
</div>
</td>
</tr>
<tr >
<td >

</td>
</tr>
</table>
</td>
<td class="clsmiddle"></td>
<td height="400" valign="top" align="center">
<div id="frmhistoryinventory_divDetail" class="divDialog" align="center"> 
<table class="width100">
<tr>
<td class="width100">
<div id="frmhistoryinventory_divDetail_grid" >
</div> 
</td>
</tr>
<tr>
<td>
<button class="cancelDialog"> Đóng</button>
</td>
</tr>
</table>
</div>
<div id="frmhistoryinventory_divGrid" class="divGrid"></div></td>
<td class="clsend"></td>
</tr>
</table>
 <script language="javascript">
 changeWaiting(0); 
var frmhistoryinventory_cal1 = CreateCalObject('frmhistoryinventory_date1', 'frmhistoryinventory_imgcal1'); 
var frmhistoryinventory_cal2 = CreateCalObject('frmhistoryinventory_date2', 'frmhistoryinventory_imgcal2'); 
$(document).ready(function () {
    initForm('frmhistoryinventory_tblinfo');
    //initForm('frmhistoryinventory_divDetail');
    initDivleft();
    $('#frmhistoryinventory_divDetail').dialog({
        autoOpen: false,
        modal: true,
        width: 800,
        resizable: true,
        overflow: 'auto' 
    }); 
});

function frmhistoryinventory_createReport(){
    if(!checkDate('frmhistoryinventory_date1','frmhistoryinventory_date2',365)){
        return false;
    }
    fromdate = ConvertoDateEN($('#frmhistoryinventory_date1').val());
    todate = ConvertoDateEN($('#frmhistoryinventory_date2').val());
    changeWaiting(0);
    xajax_frmhistoryinventory_loadGrid(fromdate,todate);  
}
function frmhistoryinventory_viewdetail(id,from_date,to_date,product_name){
    $('#frmhistoryinventory_divDetail_grid').html('');
    title = 'Chi tiết xuất nhập : ['+ product_name + ' từ ngày' +from_date +'] đến ngày ' + to_date;
    $('#frmhistoryinventory_divDetail').dialog('option','title',title);
     xajax_frmhistoryinventory_viewdetail(id,from_date,to_date);
} 

$('#frmhistoryinventory_date1').val(GetCurrentDateTime(0,0,false,0)) ;
$('#frmhistoryinventory_date2').val(GetCurrentDateTime(0,0,false,0)) ;

frmhistoryinventory_createReport();
 </script>